package com.dong.demo;

public class Flyer {
    private  Point position;
    private Double speed;

    public Flyer(Point position, Double speed) {
        this.position = position;
        this.speed = speed;
    }
    public  void fly(){
        if (position.getX()>300){
            System.out.println("逃脱成功");
            Application.isStop=true;
            return;//后续代码不要继续执行
        }
        //调用了点对象的movex方法进行偏移
        position.moveX(0.05*speed);

    }

    public Point getPosition() {
        return position;
    }
}
